<?php

use app\common\services\StaticServices;
use yii\helpers\Url;

?>

<?= Yii::$app->view->renderFile('@app/modules/admin/views/common/tab_commission.php', ['tab' => 'set']) ?>
<div class="ui equal width grid">
    <div class="column">
        <div class="panel">
            <div class="panel-alone-content">
                <form class="ui form">
                    <div class="field">
                        <label>订单选择:</label>
                        <div class="ui selection dropdown _dropdown" tabindex="0">
                            <input type="hidden" name="recommend-id"
                                   <?php if (isset($info['id'])): ?>value="<?= $info['id'] ?>" <?php endif; ?>>
                            <i class="dropdown icon"></i>
                            <div class="<?php if (!isset($info['id'])): ?>default<?php endif; ?> text"><?= isset($info['id']) ? (StaticServices::getCommission())[$info['id']] : '请选择类型' ?></div>
                            <div class="menu transition hidden" tabindex="-1">
                                <?php foreach (StaticServices::getCommission() as $key => $item): ?>
                                    <div class="item <?php if (isset($info['id']) == $key): ?>active selected<?php endif; ?> "
                                         data-value="<?= $key ?>"><?= $item ?></div>
                                <?php endforeach; ?>

                            </div>
                        </div>
                    </div>
                    <div class="field">
                        <label>客户姓名:</label>
                        <input type="text" name="member-name" placeholder=""
                               value="<?= isset($info['member_name']) ? $info['member_name'] : '' ?>">
                    </div>
                    <div class="field">
                        <label>推荐人姓名:</label>
                        <input type="text" name="recommend-name" placeholder=""
                               value="<?= isset($info['recommend_name']) ? $info['recommend_name'] : '' ?>">
                    </div>

                    <div class="field">
                        <label>佣金:</label>
                        <input type="text" name="recommend-commission" placeholder=""
                               value="<?= isset($info['recommend_commission']) ? $info['recommend_commission'] : '' ?>">
                    </div>


                    <input type="hidden" name="_csrf" id='csrf' value="<?= Yii::$app->request->csrfToken ?>">
                    <input type="hidden" name="recommend-id" value="<?= isset($info['id']) ? $info['id'] : 0 ?>">
                    <button class="ui green basic button commission-save  " type="button">提交</button>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    require(['modules/recommend/commission'], function (set) {
        set.commission_dowm('dropdown')
        set.commission_set()
    });
</script>